package handlers

import (
	"github.com/gin-gonic/gin"
	_ "github.com/mattn/go-sqlite3"
	"gorm.io/driver/sqlite"
	"gorm.io/gorm"
	"log"
	"tyy_linux_system/models"
)

func GetRefuceConnectFromList() func(context *gin.Context) {
	return func(context *gin.Context) {
		db, err := gorm.Open(sqlite.Open("./test.db"), &gorm.Config{})
		if err != nil {
			log.Println(err)
		}
		var m []models.RefuseConnectFrom
		if err := db.Find(&m).Error; err != nil {
			log.Println(err)
		}
		context.JSON(200, gin.H{
			"result": m,
		})
	}
}
